<?php

/**
 * This is the model class for table "kematianmelahirkan".
 *
 * The followings are the available columns in table 'kematianmelahirkan':
 * @property integer $km_id
 * @property integer $km_kec
 * @property integer $km_pendarahan
 * @property integer $km_eklamsi
 * @property integer $km_infeksi
 * @property integer $km_lain
 * @property integer $km_jumlah
 * @property integer $km_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $kmKec
 */
class Kematianmelahirkan extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Kematianmelahirkan the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'kematianmelahirkan';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('km_kec, km_pendarahan, km_eklamsi, km_infeksi, km_lain, km_jumlah, km_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('km_id, km_kec, km_pendarahan, km_eklamsi, km_infeksi, km_lain, km_jumlah, km_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'kmKec' => array(self::BELONGS_TO, 'Kecamatan', 'km_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'km_id' => 'Km',
			'km_kec' => 'Km Kec',
			'km_pendarahan' => 'Km Pendarahan',
			'km_eklamsi' => 'Km Eklamsi',
			'km_infeksi' => 'Km Infeksi',
			'km_lain' => 'Km Lain',
			'km_jumlah' => 'Km Jumlah',
			'km_tahun' => 'Km Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('km_id',$this->km_id);
		$criteria->compare('km_kec',$this->km_kec);
		$criteria->compare('km_pendarahan',$this->km_pendarahan);
		$criteria->compare('km_eklamsi',$this->km_eklamsi);
		$criteria->compare('km_infeksi',$this->km_infeksi);
		$criteria->compare('km_lain',$this->km_lain);
		$criteria->compare('km_jumlah',$this->km_jumlah);
		$criteria->compare('km_tahun',$this->km_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}